from datetime import datetime, date, timedelta

datetime_format = "%Y-%m-%d %H:%M:%S"


def get_datetime_now():
    current_datetime = datetime.now()
    formatted_datetime = current_datetime.strftime("%Y-%m-%d %H:%M:%S")
    return formatted_datetime


def str_to_datetime(date_string: str, formater: str = "%Y-%m-%d %H:%M:%S"):
    return datetime.strptime(date_string, formater)


def get_date_today():
    today = date.today()
    return today.strftime("%Y-%m-%d")


def get_time_in_fifteen_minutes():
    time_in_fifteen_minutes = datetime.now() + timedelta(minutes=15)
    return time_in_fifteen_minutes.strftime("%H:%M")


def get_time_now():
    now = datetime.now()
    return now.strftime("%H:%M")


def combine_date_time(date_str: str, time_str: str):
    # 将字符串转换为datetime对象
    date_obj = datetime.strptime(date_str, "%Y-%m-%d")
    time_obj = datetime.strptime(time_str, "%H:%M")

    # 合并日期和时间
    combined_datetime = datetime.combine(date_obj.date(), time_obj.time())

    return combined_datetime
